/* eslint-disable react/prop-types */
import { Pie } from "@ant-design/plots";
export type countPieProps = {
	data: Array<any>;
};
const CountPie: React.FC<countPieProps> = props => {
	const { data } = props;
	const config = {
		color: ["#1890ff", "#f5222d"],
		appendPadding: 10,
		data,
		angleField: "value",
		colorField: "fieldName",
		radius: 0.8,
		label: {
			type: "inner",
			offset: "-30%",
			// @ts-ignore
			content: ({ percent }) => `${(percent * 100).toFixed(0)}%`,
			style: {
				fontSize: 14,
				textAlign: "center"
			}
		},
		interactions: [
			{
				type: "element-active"
			}
		]
	};
	// @ts-ignore
	return <Pie style={{ height: "200px" }} {...config} />;
};

export default CountPie;
